#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<stack>
#include<cmath>
#include<string>
#include<unordered_set>
using namespace std;


void solve()
{
    int n, q; cin >> n >> q;
    vector<int> arr(n + 1), num(1);
    unordered_map<long long, long long> ma;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    for (int i = 1; i < n; i++) num.push_back(arr[i] - arr[i - 1] - 1);
    ma[n - 1] += 2;
    for (int i = 1; i < n; i++)
    {
        long long temp = (long long)i * (n - i);
        ma[temp] += num[i];
        temp = (long long)(n - i + 1) * (i - 1) + n - i;
        if (i != 1) ma[temp] += 1;
    }
    for (int i = 0; i < q; i++)
    {
        long long temp; cin >> temp;
        cout << ma[temp] << ' ';
    }
    cout << endl;
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}